<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ include file="/pages/template/page-begin.jspf" %>
<%
	_pageTitle = "Games"; 
	_pageId = "games"; 
	_mainPageId = "games"; 
%>
<%@ include file="/pages/template/head-begin.jspf" %>
<%@ include file="/pages/template/head-end.jspf" %>

<body>
	<%@ include file="/pages/template/content-begin.jspf" %>
	<%@ include file="/pages/template/bar-left.jspf" %>
	<%@ include file="/pages/template/bar-right.jspf" %>
	
	<div id="content">
		<h3>Active Games</h3>
		<hr />
		<%
		//list few last games
		List<Game> games = GameProvider.getInstance().getGameManager().getActiveGames();
		if(games.size()>0)
		{
			for(Game game : games)
			{
			%>
			<div class="featurebox_center" style="">
				<a href="/pages/playgame.jsp?gameId=<%=game.getId()%>" style="float:right">Play Now</a>
				 #<%=game.getId()%> <%=game.getDescription()%>  <br />
				 Prize: <%=ValidationForm.PRICE_FORMAT.format(game.getMaxPrize())%> <br />
				Closes: <%= ValidationForm.DATE_FORMAT.format(game.getCloseDate()) %> <br />  
			</div>
			<%
			}
		}
		else 
		{
		%>
		No active games
		<%
		}
		%>
		<br /><br />
		<h3>Past 10 Games</h3>
		<hr />
		<%
		//list few last games
		List<Game> pastGames = GameProvider.getInstance().getGameManager().getFinishedGames();
		if(pastGames.size()>0)
		{
			for(int i=0; i<10 && i<pastGames.size(); i++)
			{
				Game game =  pastGames.get(i);
			%>
			<div class="featurebox_center" style="">
				 #<%=game.getId()%> <%=game.getDescription()%>,  Prize: <%=ValidationForm.PRICE_FORMAT.format(game.getMaxPrize())%> <br />				 
				  Winning #: <%= game.getWinningNumbersRaw() %>,  Finished: <%= ValidationForm.DATE_FORMAT.format(game.getResultDate()) %>   
				 <br />  
			</div>
			<%
			}
		}
		else 
		{
		%>
		No past games
		<%
		}
		%>		
				
	</div>

	<jsp:include page="/pages/template/content-end.jspf" />
	
</body>
</html>
